package com.example.demo.dao;

import com.example.demo.Entity.Department;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Component
@Mapper
public interface EmpMapper {

    @Select("select * from department where id=#{id}")
    public Department selectById(int id);

//    获取自增主键
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into department(departmentName) values(#{departmentName})")
    public int insertDep(Department  department);
}
